Skip to content

Organizations, phase 2: each organization governs itself, its own memory and Learning, one's own organization and invitations, teams, and Desktop connected to a remote OpenBot - #1705

Merged
davidmckayv merged 167 commits into
mainfrom
orgs/phase2-fused
Nov 16, 2026

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Organizations, phase 2, fused into one branch: each organization governs itself, memory and Learning are kept per organization, an organization of one's own at first sign-in with invitations, teams inside an organization, and OpenBot Desktop connected to an OpenBot that runs somewhere else.

This branch merges, at their current heads:

On top of the merges:

  • The spec bundled once and the clients generated again from it, keeping every piece's additions in the shared spec files.
  • The teams tests' organization and member fixtures carry the fields an organization and a member answer with (personal, removable, assignableRoles).
  • The rust-toolchain action's pin is commented with the tag it is (v1), as the static analysis of the workflows asks.

Checked locally: format, lint, typecheck, API lint, the teams, Learning and audit tests.

Draft: the pieces' own PRs stay open; this lands them together after one end-to-end test.

…ewhere

Connected, nothing of OpenBot runs on this computer, so Settings, Computer shows where the app is connected, Sign out, and Use OpenBot on this computer instead, in place of the local services, memory and install folder. The app's version, updates and log folder stay. The page holds no sign-in there, so every Sign out asks the desktop app, and a sign-in that stopped working returns to the desktop app's setup. A desktop app from before it could connect is read as OpenBot on this computer, and a browser is unchanged.
A person had no way to make their first API key from the app: the operations were in the spec and nothing called them. Settings now has API keys under You. It lists the person's keys with when each was made, last used and expires, creates one by name and shows it once with Copy, and revokes one after asking.

Two answers from the API read as a sentence, not an error. An OpenBot with no sign-in (503 SIGN_IN_UNAVAILABLE) says it has no keys. A caller that is not signed in on the web (403), which is OpenBot Desktop connected to an OpenBot elsewhere, is told to create keys from OpenBot in the browser, with a button that opens the page there.

The spec's description and its appOAuth and apiKey schemes now state what a developer needs: the public client ids, loopback redirect addresses, the metadata, authorize, token and revocation endpoints, token prefixes and lifetimes, consent, and how to get a first key. Text only, so the generated clients are unchanged.
The first screen's OpenBot for Business choice can now be picked. It asks
for the address of the OpenBot a company runs in place of what this
computer needs and Install, then signs in through the browser. Nothing is
installed or started on this computer for it. The booking link moves to
that screen, for a company that has no OpenBot yet. OpenBot Cloud is still
shown as coming soon, and Self-hosted is unchanged.

Setup asks the shell where OpenBot runs before anything else. A saved
connection opens that OpenBot, or shows the first screen with the address
filled in and the reason the sign-in ended, and none of the checks,
downloads or starts of an install on this computer run. A shell that does
not know the question is an install on this computer, as before.

What goes wrong is said in the shell's own sentence. The screen reads only
its kind to choose what to offer: the field to fix, Try again, Sign in
again, or opening that OpenBot in the browser. Use OpenBot on this computer
instead goes back, and switches a saved connection first.
…s computer

A person who already runs OpenBot here had no way back to the choice of where it runs. Settings, Computer now has a Connection row that, after a confirm, stops OpenBot here and opens setup at that choice. It is drawn only by a desktop app that can connect.
… this computer

A connection that didn't work is not a failed install. Every connection
problem that is not about the address itself now shows the shell's
sentence in the calm notice, with no failure heading and no
troubleshooting logs, and the way on is the screen's button: Try again,
Sign in again, or Open in browser beside Connect. The connect screen no
longer scrolls at the window's default size. The failure card is as it was
for setup on this computer.

Setup also asks the shell whether the person chose, in Settings, to pick
where OpenBot runs. When they did, the first screen shows whichever way
OpenBot runs today. On a computer that already runs OpenBot, nothing
starts while the choice shows, and Continue goes on as any relaunch does.
OpenBot Desktop could only run OpenBot on the computer it is installed on. This adds what it
takes to show an OpenBot that runs somewhere else instead, as a library module of its own
(desktop/src-tauri/src/connected) that nothing calls yet.

choice: which of the two the person chose, in connection.json in the app's configuration folder,
with the address and the organisation picked there. No file means on this computer.

address: a typed address kept as scheme and host (https, or http for 127.0.0.1 and [::1]; no
scheme is taken as https), and two public questions asked of it: what it offers and how an app
signs in to it (RFC 8414). Each way that can go wrong is one kind with its own sentence: not an
address, unreachable, not an OpenBot, one person's OpenBot on its own computer, a release from
before apps could sign in. A redirect to another host is not followed, and metadata that names
another host is refused.

sign_in: OAuth 2.1 authorization code with PKCE (S256) as the public client
openbot-desktop-oauth, with a listener on 127.0.0.1 at a port the system picks and a redirect of
exactly /callback. The verifier, the state and the callback's first line use what
provider_oauth already has (its random and its challenge are now shared, unchanged). The wait
ends on the code, a refusal, Cancel or ten minutes. After the exchange the OpenBot is asked
/api/me with the new token; a 401 there means it cannot serve the app. Refresh tokens rotate, so
one refresh runs at a time and the new token is stored before the old one is let go. Sign-out
revokes both tokens (RFC 7009) and forgets the sign-in.

credentials: the refresh token in the system's credential store through keyring 4.2 (Keychain,
Credential Manager, the Secret Service), under the app's identifier and the address. The access
token stays in memory. Nothing token-shaped is written to a file or a log, and the log's
redaction now also covers OpenBot's own token prefixes and the relay's cookie.

relay: an HTTP/1 server on 127.0.0.1 only, at a port the system picks, that passes each request
and WebSocket upgrade on to the one typed address with the access token added. It answers only
its own Host, only requests that carry the secret made for that run (given to the window as an
HttpOnly, SameSite=Strict cookie at an entry address that is never forwarded), and no request
from another site. Absolute request targets and CONNECT are refused and redirects are handed
back, rewritten onto the relay when they point at the typed address. Origin, Cookie, Referer,
Forwarded and X-Forwarded-* are dropped on the way out and Set-Cookie on the way back. Bodies
stream both ways. The organisation the person picked is named in a header on every request, set
by the shell and never taken from the page. A 401 to a request with no body leads to one refresh
and the request again; a refused refresh says the session ended, once, and the relay stops.

The tests run against a stand-in OpenBot that answers the same addresses the same way: the
metadata document, a form-encoded token endpoint with the client's id in the body, the verifier
really checked, a code that burns on a wrong verifier, rotating refresh tokens where a replayed
one answers invalid_grant, revocation, and a redirect that must be http://127.0.0.1:<port>/callback.
The credential store in tests is keyring's own in-memory one.

New crates: keyring and keyring-core; tokio, hyper, hyper-util, http-body-util, bytes and
futures-util, which reqwest and Tauri already build; tokio-tungstenite for the tests' WebSocket.
The setup window and OpenBot's own page can now ask the shell to connect to an OpenBot at an
address, and the shell behaves accordingly while it is connected. On this computer, nothing
changes.

For the setup window: connection, check_openbot_address, connect_to_openbot, cancel_connect,
show_connected, sign_out_of_openbot, use_this_computer and take_connection_notice. A failure
carries a kind beside its sentence so the window can choose what to offer. Connecting checks the
address, signs in through the person's browser, stops an OpenBot running on this computer the way
Stop does, starts the relay and points the window at it; the choice is kept only once that has
worked. When a sign-in ends while OpenBot shows, the relay stops, setup comes back and the
sentence waits for it.

For OpenBot's page, through the openbot-desktop plugin: connection, sign_out, change_connection
and set_organization, each with a permission of its own granted to the relay's origin as the
others are. change_connection also works on this computer: it stops OpenBot as Stop does and
asks setup to open at the choice. While connected, status answers the app's version, build and
log folder without asking an engine, and restart, stop, intelligence, ai_connection and
change_ai_connection are refused.

The relay's origin is trusted the way a local OpenBot's is, so its page is OpenBot's own page to
the window: the overlay title bar, the theme, notifications, dictation, zoom, and links to
anywhere else (the typed address included) opening in the browser.

While the choice is to be connected, nothing of an installation on this computer is started,
read or written: the engine is not woken, nothing is downloaded or made ready, Start, Show and
the upgrade are refused, the installation's folder is not looked for at launch, and Quit only
stops the relay. The tray and the menu carry Show Window, Open Log Folder, Sign Out and Quit.

The setup window's connect_openbot step is one the shell's telemetry knows; its events carry the
step's name and never the address.

docs/desktop-install.md says what the choice is, how sign-in and the relay work, and what is not
there while connected.
…runtime after sign-in

The boundary check found the new addresses Desktop's native side writes by hand: the deployment question, OAuth's discovery document and the check after sign-in. Each is now listed with its rule. The check after sign-in asks the runtime's own address, which is what the app's screens need from an app's sign-in and an address that stays, in place of /api/me. The test stand-in's file name now ends in _tests.rs so the scan reads it as a test.
A company with no OpenBot of its own has no address to type, and the
booking link is how it asks for one. The link is back on the first screen
whichever choice is picked: one line under the OpenBot for Business row,
outside the row, so opening it does not pick the row. The connect form no
longer repeats it.

Two gaps on the first screen are a few pixels tighter, so everything on it
still shows at the window's default size without scrolling.
The relay added the access token and the organisation header to every request it passed on. The
same host name can serve things that are not OpenBot's: on a company's cluster a socket at a path
outside OpenBot's own goes straight to another service, which checks a join token of its own.
The page reaches that socket through the relay too, so the relay was handing the person's OpenBot
sign-in to a service that has no business seeing it.

The token and the organisation header are now added only to requests and WebSocket upgrades
whose path is /api, starts with /api/, or starts with /.well-known/. Every other path (the app's
pages and files, /client/websocket and anything else) is passed on with neither. An
Authorization or organisation header the page sent is still dropped on every path, and the rest
of the relay's rules (its own Host, the window's cookie, no other site, the stripped headers, the
one address) are the same for every path.

A request that carried no sign-in asks for no token, so it waits on no refresh, and a 401 to one
is somebody else's refusal: it is handed back as it is and uses no refresh token.

The stand-in OpenBot serves a socket at /client/websocket that takes no OpenBot token, a file at
/assets/app.js, and a path that answers 401 for reasons of its own.
A team is a named group of an organization's members. The new area lists, creates, changes and deletes teams, and lists, adds and removes each team's people, under /api/v2/organizations/{organizationId}/teams. A team says where it comes from (made here, or kept in step with a directory group), the caller's role in it and whether the caller may manage it.
A publication can name teams by id beside people, and a published Bot says which teams it reaches. An assignment names a team as team: followed by its id. Additions only: nothing an existing caller sends or reads changes.
The teams list (every page), one team, its people and the organization's members to choose from, with create, change, delete, add a person with a role and remove one. Keys are rooted at teams, never at organizations: a team belongs to one organization, so its answers are dropped when the person switches.
A list of the organization's teams, New team on its own screen for whoever may create one, and a team's page: its name and description, the team it sits under, and its people with their roles. What is offered follows the server's verdicts, a member who can't manage a team reads it and may leave, and a team from the company's directory offers no editing.

Tested on the app's query client and a router against the generated handlers, with two organizations that each keep their own teams.
The Publish dialog ticks teams from the organization's own list beside people's addresses, a published Bot names the teams it reaches, and an admin assigns it to a team or to everyone from a list. Directory groups a Bot was already published to are shown and kept; none is typed any more.

Everybody is said as everyone in the organization, since a team is now one group inside it.
The Teams list, a team's page, New team and a Bot's Publish dialog are drawn in Admin's real frame at 1440, 700 and 390 pixels, light and dark: no sideways scroll, every control whole inside the window, and a row's actions never on top of its words. Chromium in CI; WebKit when asked for.
A team is now a named group inside an organization, so no sentence calls everybody a team: Admin's last group is Organization, with Teams in it; the rules and settings an admin sets for everybody are organization rules and settings; the account an organization connects once is the shared account; the network allowlist is the organization's. Wire values, addresses and the edition's own name are unchanged.

The copy skill's glossary gains organization, team and shared account.
A team now carries canMove and canDelete beside canManage, and a team's member carries isCaller, so a screen shows each action only to who may take it without working the rules out itself. Only an owner or an admin of the organization changes a team's parent.
Teams is now in the menu under the person's name, in the team edition, at /teams: a member sees the organization's teams and which they are in, opens one and can leave it, and a team's maintainer renames it and keeps its people without being an admin. The pages that were under Admin lead there, and Admin still lists Teams.

What a team's page offers is the server's verdict on the person and the team: canManage for its name and people, canMove for the team it is under, canDelete for deleting it, and the member marked isCaller is you. The page no longer compares ids or reads the right to create a team as a stand-in for an admin.
…ee it

The layout test now draws the Teams list and a team's page in the app's own frame for each of the three people who open them, and the menu under the person's name open with Teams in it, wide, narrow and on a phone, in light and dark. Skills is drawn beside them when screenshots are asked for, to compare.

Each width gets a stylesheet of its own: a narrow window draws the bar with the sidebar's button, which the wide one's stylesheet had no rules for.
A permission switch, a network policy and a shared app account's audience can be for a team, by its id, beside a directory group by its name. An app or a skill can be granted to teams: their members may put it on Bots they own and use it without an access request. A what-if question can ask about anyone in a team.

Additions only: each new response value has its line in api/accepted-breaking-changes.md. The whole-organization values that are spelled team stay as they are.
A person's memory and Learning spaces belong to one organization: nothing remembered or learned in one is listed, recalled or shared in another the person belongs to. The Learning and memory areas of the spec now say so, and that sharing a skill with every Bot means every Bot in the organization. Descriptions only; no operation or schema changes shape.
An organization's own admins now read and set what is the organization's: its settings, vault, apps, shared accounts, components, skills, computers, usage and audit trail. The spec's descriptions said or implied these were the whole OpenBot's, and Admin screens said "this deployment".

The spec now says whose each thing is and gives the answers that follow: 409 for requiring SSO outside the organization default, 404 for a computer that is not the organization's, 400 for a Slack, Teams or phone destination connected in another organization, and 400 for an announced component name that starts with @. It names the organization events on the audit trail, and says the Recorder's own operations act in the connection's organization. Descriptions and examples only: no breaking change.

The audit trail's What column and filters gain words for the six organization events, with a test on the Audit page. Admin screens say "this organization" where the thing is the organization's, and the docs that quote the app switch's label follow it.
…d text

The Credentials and Apps tags and the apps:read scope still described the vault and the added apps as this OpenBot's. Each organization has its own, as the operations under them now say.
Stopping, resetting or updating a computer that is not the organization's answers BOT_NOT_FOUND with "Couldn't find that computer.", in the same problem shape as a Bot that is not found. The example said NOT_FOUND.
davidmckayv and others added 14 commits November 15, 2026 20:09
…timed-out one

After "Sign-in didn't finish", the first Try again showed the code that had
just timed out, and approving it said it had expired; only the second Try
again got a new code. The CLI saves the code a `login` is waiting on and
shows it again in the next `login` unless the one before ended by itself.
OpenBot stops a `login` that waits past 15 minutes (or is cancelled), which
left that code saved for the next one.

The shell now forgets the CLI's saved sign-in code before each sign-in it
starts, in the CLI's turn, so every sign-in gets a new code. The sign-in
wait keeps the page it shows with the sign-in that printed it, so a code
from an earlier sign-in is never shown for a new one, and a sign-in still
running is stopped before a new one starts.
A run refused by an admin's model allowlist, or by a switch that is off,
read in the chat as "OpenBot couldn't reach its backend". CopilotKit's
client throws every failed run request as "REST run request failed: <the
body>", with the status gone, and every such failure was taken for an
outage. The server now refuses with a problem whose type is OpenBot's own;
a REST failure carrying one passes on its detail, and anything else (a raw
body, another problem, a server fault) still reads as the backend failing.
An admin taking the picked model off the allowlist while a conversation
was open left the picker on the old model and ran the next message on the
default without a word. Each send now reads the conversation's model again,
which brings the picker in line, and when the person's own pick has turned
into the default and the model is no longer offered, the composer says
which model the conversation now uses. The notice goes when they pick a
model or the model is offered again.
…lt from reading as done

The server words a task's failure to follow "Couldn't finish:" ("this Bot isn't shared with you any more"), and the task card drew it as a line of its own, starting in lower case. The card now draws it as a sentence: a capital first letter and a full stop.

A task's result whose turn left the task waiting on the person (an app's Request access card drawn under it) showed a green check on its link while the card above read Needs you. The link now reads as needing them while the task does.

Tests seen failing first.
The menu was exactly as wide as the account row, so at the sidebar's narrowest a person's own organization read "Ana Lindqvist's organizati...". The menu now grows to its words, up to 24rem and never past the window, and a name still cut reads whole in a tooltip, on hover and when the keyboard highlights the row, as the account row's own tooltip does. The measuring hook moves to app/src/hooks so both share it.

organization-menu-names.test.tsx opens the real menu in Chromium at the sidebar's default and narrowest widths and in a 700px window's sheet, and joins CI's browser tests.
…in's

A private Bot says "Only you can see it and talk to it", but an admin's list of
Bots held everybody's private ones, so an organization's owner saw a member's
private Bot on their Bots page under "Shared with you".

listBots now answers only the Bots the caller can see, an admin included, and
takes scope=organization for every Bot in the organization, which only an admin
of it may ask for. Admin's screens that decide what Bots may hold (Apps, a Bot's
page under an app, a tool's and a skill's Bots, Components, Learning, Computers,
describing approval rules) ask for it through Admin's layout, so they list every
Bot as before. Every other screen lists the caller's.
…f every Bot

scope=organization lists every Bot in the organization for an admin's screens,
and it answered somebody else's private Bot in full, its role description and
subtitle included. Those screens show a Bot's name and whether the admin hid it,
nothing more.

A Bot now says withheld: true when it is somebody else's private Bot listed
there, and carries its id, name, avatar and the caller's own state with it only:
an empty title and role description, no address, instructions or framework, and
every setting false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant